package com.commerce.img.adapter;


import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.commerce.img.entity.DataUrl;
import com.commerce.img.MyAppData;
import com.commerce.img.fragemt.BlankFragment;

import java.util.List;

public class MyFragmentPagerAdapter extends FragmentPagerAdapter {
    List<DataUrl.ImgdataBean> list;
    MyAppData myAppData;
    public MyFragmentPagerAdapter(FragmentManager fm, List<DataUrl.ImgdataBean> list, MyAppData myAppData) {
        super(fm,BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
        this.list = list;
        this.myAppData=myAppData;
    }
    @Override
    public Fragment getItem(int position) {
        myAppData.setI(position);
        return new BlankFragment(list.get(position).getImgecy(),myAppData);
    }
    @Override
    public int getCount() {
        return list.size();
    }
}
